#include "SelectDataBase.h"


SelectDataBase::SelectDataBase()
{

}

SelectDataBase::~SelectDataBase()
{

}


QList<QString> SelectDataBase::selectAllEffects()
{
    listEffects.clear();
    QSqlQuery query;
    query.exec("SELECT id, name FROM effects");
    while(query.next())
    {
        QString str = query.value(0).toString() +"# " +query.value(1).toString();
        listEffects.append(str);
    }
    return listEffects;
}


QList<QString> SelectDataBase::selectAllElements()
{
    listElements.clear();
    QSqlQuery query;
    query.exec("SELECT id, name FROM elements");
    while(query.next())
    {
        QString str = query.value(0).toString() +"# " +query.value(1).toString();
        listEffects.append(str);
    }
    return listElements;
}

QList<QString> SelectDataBase::selectAllClass()
{
    listClass.clear();
    QSqlQuery query;
    query.exec("SELECT id, name FROM class");
    while(query.next())
    {
        QString str = query.value(0).toString() +"# " +query.value(1).toString();
        listEffects.append(str);
    }
    return listClass;
}

QList<QString> SelectDataBase::selectAllRaces()
{
    listRaces.clear();
    QSqlQuery query;
    query.exec("SELECT id, name FROM race");
    while(query.next())
    {
        QString str = query.value(0).toString() +"# " +query.value(1).toString();
        listEffects.append(str);
    }
    return listRaces;
}

QList<QString> SelectDataBase::selectAllSpells()
{
    listSpells.clear();
    QSqlQuery query;
    query.exec("SELECT id, name FROM spells");
    while(query.next())
    {
        QString str = query.value(0).toString() +"# " +query.value(1).toString();
        listEffects.append(str);
    }
    return listSpells;
}
